
package org.dromara.easyai.extensions.solon.test.controller;

import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Get;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.Context;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author: aoshiguchen
 * @date: 2023/6/30
 */
@Controller
public class IndexController {

    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

    @Get
    @Mapping("/")
    public String home(Context ctx) {
        return "welcome to easyai-extensions-Ascend test index page.";
    }

    @Get
    @Mapping("/hello")
    public String hello() {
        return "hello aoshiguchen";
    }

    @Get
    @Mapping("/time")
    public String time() {
        return String.format("HTTP/1.1 当前时间：%s", sdf.format(new Date()));
    }

}
